<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="../common/jspcommon.jsp"%>
<%@include file="../common/jscss.jsp"%>
<%@include file="../common/selfCss.jsp"%>
<html>
<head>
<title>艺术家作品列表页</title>
<script type="text/javascript">
	var artPicList_grid = null;
	$(function() {
		artPicList_grid = $("#picList_grid")
				.ligerGrid(
						{
							title : '内容列表',
							columns : [

										{
											display: '操作', 
											name: 'picId',
											isAllowHide: false, 
											isSort : false,
											width:300,
											render: function (record, rowindex, value, column){
												//alert(value);
												var html = '<a onclick="choice(\''+ value + '\')" href="javascript:;">设为精选</a>&nbsp;<a onclick="noChoice(\''+ value + '\')" href="javascript:;">取消精选</a>&nbsp;<a onclick="deletePic(\''+ value + '\')" href="javascript:;">删除</a>&nbsp;<a onclick="updatePic(\''+ value + '\')" href="javascript:;">更新</a>&nbsp;'; 
												return html; 
											}
										},
										{
											display : '是否精选',
											name : 'choice',
											isSort : false,
										},
									{
										display : '标题',
										name : 'title',
										isSort : false,
									},
									{
										display: '作品-1', 
										height:100,
										name: 'imagePath',
										isAllowHide: false, 
										isSort : false,
										render: function (record, rowindex, value, column){
											//alert(value);
											var html = '<img src="'+value+'_100x100" alt="" class="user_img"  width="100px" height="100px"/>'; 
											return html; 
										}
									},
									{
										display : '创建时间',
										name : 'gmtCreated',
										isSort : false,
										render : function(record, rowindex,
												value, column) {
											return (new Date(value.time))
													.format("yyyy年MM月dd日 hh:mm:ss");
										}
									} 
									],
							pageSize : 30,
							root : 'list',
							record : 'totalRecord',
							url : "/misc/index/artistPicListGrid.htm?artistId=${artistId}",
							width : '99%',
							height : '80%'
						});

	});
	
	//删除内容
	function deletePic(identifier){
		//alert(identifier)
		$.post("/misc/artPic/deletePic.htm", {
			identifier :identifier
		},function(data){
			if(data=="success"){
				alert("已删除");
				artPicList_grid.loadData();
			}
			if(data=="error"){
				alert("删除失败了。");
			}
		});
	
	}
	//更新
	function updatePic(identifier){
		$('#updateContent').load("/misc/artPic/updateArtPicWeb.htm?identifier="+identifier);
	}
	//精选
	function choice(identifier){
		$.post("/misc/artPic/choice.htm", {
			identifier :identifier
		},function(data){
			if(data=="success"){
				alert("已精选");
				artPicList_grid.loadData();
			}
			if(data=="error"){
				alert("精选失败了。");
			}
		});
	}
	//取消精选
	function noChoice(identifier){
		$.post("/misc/artPic/noChoice.htm", {
			identifier :identifier
		},function(data){
			if(data=="success"){
				alert("已取消");
				artPicList_grid.loadData();
			}
			if(data=="error"){
				alert("取消失败了。");
			}
		});
	}
</script>
</head>
<body>
	<div id="picList_grid" style="margin: 0; padding: 0"></div>
	<div id="updateContent"> </div>
</body>
</html>